<?php
namespace app\common\validate;
use\think\Validate;
class SelfTake extends Validate {
    protected $rule = [
        'self_take_id'               => ['require', 'length:1,20', 'unique'],
        'self_take_number'           => ['require', 'length:1,100'],
        'self_take_name'             => ['require', 'length:1,255'],
        'self_take_tel'              => ['require'],
        'self_take_business_hours'   => ['require', 'length:8,12'],
        'self_take_belongs_area'     => ['require'],
        'self_take_detailed_address' => ['require', 'length:0,255'],
    ];

    protected $message = [
        // 门店编号
        'self_take_number.require'           => '请输入门店编号!',
        'self_take_number.length'            => '门店编号长度必须大于1个字符小于100个字符!',
        // 门店名称
        'self_take_name.require'             => '请输入门店名称!',
        'self_take_name.length'              => '门店名称长度必须大于1个字符小于255个字符!',
        // 联系电话
        'self_take_tel.require'              => '请上传联系电话',
        // 分区
        'self_take_business_hours.require'   => '请选择营业时间',
        'self_take_business_hours.length'    => '营业时间长度必须大于8个字符小于12个字符!',

        // 所属区域
        'self_take_belongs_area.require'     => '所属区域',

        //详细地址
        'self_take_detailed_address.require' => '请上传详细地址',
        'self_take_detailed_address.length'  => '详细地址长度必须小于255个字符!',
    ];

    //不同的场景验证的字段不同
    protected $scene = [
        'upload'      => ['self_take_id', 'self_take_number', 'self_take_name', 'self_take_tel', 'self_take_business_hours', 'self_take_belongs_area', 'self_take_detailed_address'],
    ];
}